using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HerGoS.Interfaces;

namespace HerGoS.Administration.Entities
{
    [Serializable]
	public class Entidad :  HGSEntity, IDomicilios,IContactos
	{
		#region Construction
		public Entidad()
		{
            Initializer();
        }
        private void Initializer()
        {
            Domicilios = new List<Entities.Domicilio>();
            Contactos = new List<Contacto>();
        }

		#endregion

		#region DataMembers
		private String _Denominacion;
		private Boolean _Interna;
		private Int32? _Superior;
        private string _DenominacionEntidadSuperior;
        private Jurisdiccion _Jurisdiccion;
        private List<Domicilio> _Domicilios;
        private List<Contacto> _Contactos;

		#endregion

		#region Properties

		public String Denominacion {
		    get { return _Denominacion; }
		    set { this._Denominacion = value; }
		}

		public Boolean Interna {
		    get { return _Interna; }
		    set { this._Interna = value; }
		}

        public Int32 ? Superior
        {
		    get { return _Superior; }
		    set { this._Superior = value; }
		}

        public Jurisdiccion Jurisdiccion
        {
		    get { return _Jurisdiccion; }
		    set { this._Jurisdiccion = value; }
		}

        public string DenominacionEntidadSuperior
        {
            get { return _DenominacionEntidadSuperior; }
            set { this._DenominacionEntidadSuperior = value; }
        }

        public List<Domicilio> Domicilios
        {
            get { return _Domicilios; }
            set { this._Domicilios = value; }
        }

        public Domicilio DomicilioPrincipal
        {
            get { return this.Domicilios.Find(d => d.Principal == true); }
        }

     
        public List<Contacto> Contactos
        {
            get
            {
                return _Contactos;
            }
            set
            {
                _Contactos = value;
            }
        }

        public Contacto ContactoPrincipal
        {
            get { return this.Contactos.Find(x => x.Principal == true); }
        }

      




		#endregion
		
		#region Overrides
		/// <summary>
		/// Returns the string of the object.
		/// </summary>
		/// <returns>String</returns>
		public override String ToString()
		{
			return this.Denominacion.ToString();
		}

		#endregion

   
    }
}